import Vue from "vue";
import VueRouter from "vue-router";
import hello from "../components/HelloWorld.vue";
import login from "../views/login.vue";
import nopage from "../views/page/error-page/404.vue";
import noquanxian from "../views/page/error-page/401.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "hello",
    component: hello,
    redirect: '/XT',
  },
  {
    path: "/login",
    name: "login",
    component: login,
  },
  {
    path: "/noquanxian",  //401的页面
    name: "noquanxian",
    component: noquanxian,
  },
  {
    path: "/nopage",  //404的页面
    name: "nopage",
    component: nopage,
  },
  {
    path: "/XT",
    component: hello,
    meta: {title: '系统管理'},
    redirect: '/XT/ZDGL',
    children: [
      {
        path: "ZDGL",
        name: "ZDGL",
        meta: {title: '字典管理'},
        component: () => import("../views/page/ZDGL.vue")
      },
      {
        path: "XZQYGL",
        name: "XZQYGL",
        meta: {title: '行政区域管理'},
        component: () => import("../views/page/XZQYGL.vue")
      },
      {
        path: "RZGL",
        name: "RZGL",
        meta: {title: '日志管理'},
        component: () => import("../views/page/RZGL.vue")
      },
      {
        path: "CDGL",
        name: "CDGL",
        meta: {title: '菜单管理'},
        component: () => import("../views/page/CDGL.vue")
      },
      {
        path: "JSGL",
        name: "JSGL",
        meta: {title: '角色管理'},
        component: () => import("../views/page/JSGL.vue")
      },
      {
        path: "YHGL",
        name: "YHGL",
        meta: {title: '用户管理'},
        component: () => import("../views/page/YHGL.vue")
      },
      {
        path: "ZDGL",
        name: "ZDGL",
        meta: {title: '字典管理'},
        component: () => import("../views/page/ZDGL.vue")
      }
    ]
  },
  {
    path: "/JYZ",
    component: hello,
    meta: {title: '加油站管理'},
    redirect: '/JYZ/JYZXX',
    children: [
      // {
      //   path: "JYZXX",
      //   name: "JYZXX",
      //   meta: {title: '加油站信息'},
      //   component: () => import("../views/page/JYZGL/JYZXX.vue")
      // },
      {
        path: "JYZXX",
        name: "JYZXX",
        meta: {title: 'm页面二'},
        component: () => import("../components/mpage01.vue")
      },
      // {
      //   path: "mtwopage",
      //   name: "mtwo",
      //   meta: {title: 'm页面二'},
      //   component: () => import("../components/mpage02.vue")
      // }
    ]
  },
  {
    path: "/project",
    component: hello,
    meta: {title: '项目'},
    redirect: '/project/tuopu',
    children: [
      {
        path: "tuopu",
        name: "tuopu",
        meta: {title: '拓扑横向'},
        component: () => import("../components/tuopu.vue")
      },
      {
        path: "tuopu2",
        name: "tuopu2",
        meta: {title: '拓扑S型'},
        component: () => import("../components/tuopu2.vue")
      },
    ]
  },
  {
    path: "/echarts",
    component: hello,
    meta: {title: '图表'},
    redirect: '/echarts/one',
    children: [
      {
        path: "one",
        name: "one",
        meta: {title: 'echarts 报表'},
        component: () => import("../components/echartsdemo.vue")
      },
    ]
  },
  {
    path: "/about",
    name: "About",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
